<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2019/3/25
 * Time: 8:43
 */

namespace app\home\controller;

use think\Controller;
use think\Db;
use think\Request;

class Texam extends Controller{

    public function index(){
        $arr = [1,2,3,4];
        $count = 0;
        foreach ($arr as $key => $value){

            foreach ($arr as $ke => $val){

                if($value != $val){

                    foreach ($arr as $k => $v){

                        if($val != $v && $v != $value) {
                            $count++;
                        }
                    }
                }
            }

        }

        print $count;
    }

    public function my_dir($dir = '../'){

        $file = array();

        $dir = opendir(dirname($dir));

        if(($file = readdir($dir)) != false){

            if ($file != './' && $file != '../'){
                if(is_dir($dir."".$file)){
                     $file[$file] = $this->my_dir($dir."".$file);
                }else
                {
                    $file[] = $file;
                }
            }

        }

        print_r($file);

    }

    public function Fpath($apath = '/a/b/c',$bpath = '/a/b/d'){

        $str = '';

        $a = explode('/',dirname($apath));

        $b = explode('/',dirname($bpath));

        for ($i = 0 ; $i < count($a) ; $i++){
            for ($j = 0 ; $j < count($b) ; $j++){
                if($a[$i] == $b[$j]){
                    $str .= $a[$i].'/';
                }
            }
        }

        print_r($str);
    }

    public function rolltime(){
        return $this->fetch('time');
    }



}